#pragma once

#ifndef LayoutStruct_H
#define LayoutStruct_H

#include "IntrusivePointer.h"
#include "Referenced.h"

namespace fusion
{
    namespace mode10
	{
		struct MeasureSpec : public Referenced
		{
		public:
			enum MeasureMode
			{
				EXACTLY,// The parent has determined an exact size for the child.
				AT_MOST,// The child can be as large as it wants up to the specified size.
				UNSPECIFIED // The parent has not imposed any constraint on the child.
			};

			MeasureMode Mode;
			int Size;
			static fusion::Ref<MeasureSpec> GenerateMeasureSpec(int size, MeasureMode mode);
		private:
			MeasureSpec();
		};

		class BaseLayoutParams : public Referenced // for width, height
		{
		public:
			static const int WRAP_CONTENT;
			static const int MATCH_PARENT;

			BaseLayoutParams(int width, int height);
			BaseLayoutParams(const BaseLayoutParams& params);

			void SetHeight(int height);
			void SetWidth(int width);
			int GetHeight() const { return m_Height; }
			int GetWidth() const { return m_Width; }
		private:
			int m_Height;
			int m_Width;
		};

		class MarginLayoutParams : public BaseLayoutParams
		{
		public:
			static const int MarginLeft;
			static const int MarginRight;
			static const int MarginTop;
			static const int MarginBottom;

			MarginLayoutParams(int width, int height);
			MarginLayoutParams(const MarginLayoutParams& params);
			void SetMargins(int left, int top, int right, int bottom);

			int GetLeftMargin() const { return m_LeftMargin; }
			int GetRightMargin() const { return m_RightMargin; }
			int GetTopMargin() const { return m_TopMargin; }
			int GetBottomMargin() const { return m_BottomMargin; }
		private:
			int m_LeftMargin;
			int m_RightMargin;
			int m_TopMargin;
			int m_BottomMargin;
		};
	}
}
#endif